﻿using Apps.Common;
using Apps.Models;
using System.Linq;
using System.Collections.Generic;
using Apps.Models.PUB;

namespace Apps.BLL.PUB
{
    public partial class PUB_TRANSPORTBLL
    {



        public List<PUB_TRANSPORTModel> GetListBySupplierId(ref GridPager pager, string SupplierId)
        {
            IQueryable<PUB_TRANSPORT> queryData = null;
            string pid = SupplierId.ToString();
            queryData = m_Rep.GetListBySupplierId(SupplierId);
            pager.totalRows = queryData.Count();
            queryData = LinqHelper.SortingAndPaging(queryData, pager.sort, pager.order, pager.page, pager.rows);
            return CreateModelList(ref queryData);
        }

        public List<PUB_TRANSPORTModel> GetListNotINSupplierId(ref GridPager pager, string queryStr, string SupplierId)
        {
            IQueryable<PUB_TRANSPORT> queryData = null;
            if (string.IsNullOrWhiteSpace(queryStr))
            {
                queryData = m_Rep.GetListNotINSupplierId(SupplierId);
            }
            else
            {
                queryData = m_Rep.GetListNotINSupplierId(SupplierId).Where(p => p.TRANSPORT_NAME.Contains(queryStr) || p.REMARKS.Contains(queryStr));
            }

            pager.totalRows = queryData.Count();
            queryData = LinqHelper.SortingAndPaging(queryData, pager.sort, pager.order, pager.page, pager.rows);
            return CreateModelList(ref queryData);
        }


    }
}

